package com.example.chinesenation.Redis;

import java.util.List;
import java.util.Set;

/**
 * @author sakuraFallingDown
 * @version 1.0
 * @date 2021/1/11 16:31
 */
public interface RedisService {
    void put(String key,Object o);
    Object get(String key);
    void put(String key,Object o,long expireTime);
    void putMinute(String key,Object o,long expireTime);
    void putSecond(String key,Object o,long expireTime);
    void delete(String key);
    boolean hasKey(String key);
    boolean hasComment(String key);//为policy和article查找文章信息缓存时使用，防止恶意请求缓存穿透
    void addPageView(String key,String ip);
    int getPageView(String key);
    void deletePageView(String key);

    Set<String> getAllArticlePageViewKeys();
    Set<String> getAllPolicyPageViewKeys();
    void increasePageView(String key);
    void initPageView(String key,int pageview);

    void initUserInterest(String uid);
    List<Object> getUserInterest(String uid,int type);
    List<Object> getUserMainInterest(String uid);
    void changeUserInterest(String uid, int type, List<Double> interest);
    void changeUserMainInterest(String uid,int type,Double score);

    <T> List<T> pipeline(List<String> keys,T t);

    void pipelineZSet(String key,List<String> keys,List<Long> values);
}
